#!/usr/bin/expect
# （2）建数据目录
spawn mkdir -p /data/dmdbms/data/DMSERVER/bak 
spawn mkdir -p /data/dmdbms/data/DMSERVER/log
# 目录所属
spawn chown dmdba:dinstall /data/dmdbms -R
# 切换执行目录
cd /data/dmdbms/bin
# 初始化数据
spawn ./dminit
expect {
    "input system dir*" {send "/data/dmdbms/data\r"; exp_continue}
    "input db name*" {send "DMSERVER\r"; exp_continue}
    "input port num*" {send "5236\r"; exp_continue}
    "input page size*" {send "32\r"; exp_continue}
    "input extent size*" {send "32\r"; exp_continue}
    "input sec priv mode*" {send "0\r"; exp_continue}
    "input time zone*" {send "+8:00\r"; exp_continue}
    "string case sensitive*" {send "n\r"; exp_continue}
    "which charset to use*" {send "1\r"; exp_continue}
    "length in char*" {send "n\r"; exp_continue}
    "enable database encrypt*" {send "n\r"; exp_continue}
    "input slice size*" {send "4096\r"; exp_continue}
    "page check mode*" {send "0\r"; exp_continue}
    "input elog path*" {send "/data/dmdbms/data/DMSERVER/log\r"; exp_continue}
    "auto_overwrite mode*" {send "0\r"; }
}
expect eof
# 前台启动
# cd /data/dmdbms/bin
#  ./dmserver /data/dmdbms/data/DMSERVER/dm.ini
# 注册服务
# /data/dmdbms/script/root/dm_service_installer.sh -t dmserver -i /data/dmdbms/data/DMSERVER/dm.ini -p DMSERVER
# 注意：docker run 要加--privileged=true
# yum install initscripts -y
# service DmServiceDMSERVER start|stop|status